﻿using System;

namespace BehaviorModel.Block.RandomGenerator
{
    /// <summary>
    /// Random generator types.
    /// </summary>
    public enum RandomGeneratorType { Uniform, Poisson, Gaussian, Erlang }

    /// <summary>
    /// Random generator factory.
    /// </summary>
    public class RandomGeneratorFactory
    {
        private static RandomGeneratorFactory _instance = new RandomGeneratorFactory();

        private RandomGeneratorFactory() { }

        /// <summary>
        /// Returns instance of <code>RandomGeneratorFactory</code>.
        /// </summary>
        /// <returns></returns>
        public static RandomGeneratorFactory GetInstance()
        {
            return _instance;
        }

        /// <summary>
        /// Creates specific Generator with default parameters.
        /// </summary>
        /// <param name="type">Random generator type</param>
        /// <returns>Instance of <code>IRandomGenerator</code></returns>
        public IRandomGenerator Create(RandomGeneratorType type)
        {
            switch (type)
            {
                case RandomGeneratorType.Uniform:
                    return new UniformRandomGenerator();
                case RandomGeneratorType.Poisson:
                    return new PoissonRandomGenerator();
                case RandomGeneratorType.Erlang:
                    return new ErlangRandomGenerator();
                case RandomGeneratorType.Gaussian:
                    return new GaussianRandomGenerator();
                default:
                    throw new ArgumentException();
            }
        }

    }
}
